<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //分支语句
    var score="优";
    switch (score){
        case"优":
            document.write("该同学成绩优异");
            break;//break表示分支执行到此结束
        case"良":
            document.write("该同学成绩良好");
            break;
        case"及格":
            document.write("该同学成绩及格");
            break;
        case"不及格":
            document.write("该同学成绩不及格");
            break;
        default:
            document.write("该同学成绩未知");
    }
</script>
</html>